-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure derived table column names are handled correctly #15588
Make sure derived table column names are handled correctly #15588
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Is this aiming for the 19.0.2 release? |
071dc8e
to
9720b76
Compare
a580ad4
to
983dabd
Compare
a9ae7e2
to
b358743
Compare
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
40c60de
to
a55df3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest looks good to me!
// create new table ID | ||
tableID := semantics.SingleTableSet(len(ctx.SemTable.Tables)) | ||
ctx.SemTable.Tables = append(ctx.SemTable.Tables, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: more comments can be added here as adding nil
to semtable tables is not clear. I understand the intention here but comments will help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we can add the DerivedTable
here which is created below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Derived table that we create here is of a very different type than what we store in the semantic state, and the info that we normally store there does not really make sense to store here. we just need an ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. some nits
Signed-off-by: Andres Taylor <[email protected]>
…n-names Signed-off-by: Andres Taylor <[email protected]>
@systay is there a user-reported issue for this fix that is still open and should be closed? |
no, this was found during our own testing |
Description
For some situations, during planning we create derived tables. When this happens, we sometimes get the column names wrong, which leads to queries that are not correct.
Example query, with bad plan:
bad plan produced:
As you can see from the plan, one of the queries being sent down to mysql looks like:
This query would fail in MySQL with an ambiguous column error for
dt.id
.Since this change is quite involved, and these queries have never worked well, I suggest we don't backport this change set.
Related Issue(s)
Checklist
Deployment Notes